Skip to content

Bugfix #3410 ugrid lead time develop - #3425

Merged
hsoh-u merged 18 commits into
developfrom
bugfix_3410_ugrid_lead_time_develop
Sep 16, 2026
Merged

hsoh-u merged 18 commits into
developfrom
bugfix_3410_ugrid_lead_time_develop

Conversation

@hsoh-u

@hsoh-u hsoh-u commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

Expected Differences

The init_hour (or lead_time) is computed.

  1. If the time variable has the units minutes/hours since YYYY-MM-DD, sets init_time from the units attribute.
  2. If init_time variable is configured at the UGrid configurations, read the init_time variable and sets oroverride init_time
  3. Compute init_hour/lead_time from the time variable and init_time variable

As a result, the 7 output file names were changed from *_000000_* to _120000_ because init_hour 00 was changed to 12. The FCST_LEAD column at the output files were changed too.

The unit.py was updated to handle missing output files and initialized the result object to None

Refactored UGridFile::open_metadata() at ugrid_file.cc and separated two APIs: metadata_coord_variables() and metadata_time().

  • Do these changes introduce new tools, command line arguments, or configuration file options? [No]

    If yes, please describe:

  • Do these changes modify the structure of existing or add new output data types (e.g. statistic line types or NetCDF variables)? [No]

    If yes, please describe:

Pull Request Testing

  • Describe testing already performed for these changes:

by unit test
The binary files are available at seneca:/d1/personal/hsoh/git/pull_request/MET_bugfix_3410_ugrid_lead_time_develop/share/met
Note:
/d1/personal/hsoh/git/pull_request/MET_bugfix_3410_ugrid_lead_time_develop/share/met/config/UGridConfig_mpas should be applied to compute lead_hour (to read the initial_time variable).

  • Recommend testing for the reviewer(s) to perform, including the location of input datasets, and any additional instructions:

  • Do these changes include sufficient documentation updates, ensuring that no errors or warnings exist in the build of the documentation? [Yes]

  • Do these changes include sufficient testing updates? [No]

The tests themselves were not updated, but the existing tests are now producing different outputs — specifically, the file name and init_hour columns differ across the 7 files.

  • Will this PR result in changes to the MET test suite? [No]

    If yes, describe the new output and/or changes to the existing output:

The output file names are different (from 000000 to 120000). The values in the init_hour columns have also changed.

  • Will this PR result in changes to existing METplus Use Cases? [Yes]

    If yes, create a new Update Truth METplus issue to describe them.

The output file names changed from 000000 to 120000. If these are used as input for the test cases, the expected input files may no longer exist. The values in the init_hour columns have also changed.

  • Do these changes introduce new SonarQube findings? [No]

    If yes, please describe:

  • Please complete this pull request review by [Fill in date].

Pull Request Checklist

See the METplus Workflow for details.

  • Review the source issue metadata (required labels, projects, and milestone).
  • Complete the PR definition above.
  • Ensure the PR title matches the feature or bugfix branch name.
  • Define the PR metadata, as permissions allow.
    Select: Reviewer(s) and Development issue
    Select: Milestone as the version that will include these changes
    Select: METplus-X.Y Support project for bugfix releases or MET-X.Y Development project for the next coordinated release
  • After submitting the PR, select the ⚙️ icon in the Development section of the right hand sidebar. Search for the issue that this PR will close and select it, if it is not already selected.
  • After the PR is approved, merge your changes. If permissions do not allow this, request that the reviewer do the merge.
  • Close the linked issue and delete your feature or bugfix branch from GitHub.

@JohnHalleyGotway JohnHalleyGotway changed the title Bugfix 3410 ugrid lead time develop Bugfix #3410 ugrid lead time develop Aug 21, 2026
@github-project-automation github-project-automation Bot moved this to 🩺 Needs Triage in METplus-13.0 Development Aug 21, 2026
@JohnHalleyGotway JohnHalleyGotway moved this from 🩺 Needs Triage to 🔎 In review in METplus-13.0 Development Aug 21, 2026
@JohnHalleyGotway JohnHalleyGotway added this to the MET-13.0.0 milestone Aug 21, 2026

@DanielAdriaansen DanielAdriaansen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same changes as in #3424

Comment thread docs/Users_Guide/appendixH.rst Outdated
Comment thread docs/Users_Guide/appendixH.rst Outdated
@DanielAdriaansen

Copy link
Copy Markdown
Contributor

@hsoh-u I also suggest we update the MPAS test data for the UGRID capability as part of this PR. Could you try running the unit tests with this file on Seneca?

/home/dadriaan/projects/mpas/tutorial/data/fcst/mpas/ugrid/OK_12km_ugrid/2025051800/ens_1/diag.2025-05-18_12.00.00.nc

Here is the static file:
/home/dadriaan/projects/mpas/tutorial/data/fcst/mpas/ugrid/OK_12km_ugrid/init.nc

hsoh-u and others added 2 commits August 26, 2026 10:44
Co-authored-by: Dan Adriaansen <dadriaan@ucar.edu>
Co-authored-by: Dan Adriaansen <dadriaan@ucar.edu>
@hsoh-u

hsoh-u commented Sep 14, 2026

Copy link
Copy Markdown
Collaborator Author

@hsoh-u I also suggest we update the MPAS test data for the UGRID capability as part of this PR. Could you try running the unit tests with this file on Seneca?

/home/dadriaan/projects/mpas/tutorial/data/fcst/mpas/ugrid/OK_12km_ugrid/2025051800/ens_1/diag.2025-05-18_12.00.00.nc

Here is the static file: /home/dadriaan/projects/mpas/tutorial/data/fcst/mpas/ugrid/OK_12km_ugrid/init.nc

It ran OK. At seneca.

cd /d1/personal/hsoh/git/pull_request/MET_bugfix_3410_ugrid_lead_time_develop
./run_ungrid_point_stat.sh
  • pb2nc/gdas1.20250518.t12z.prepbufr.nc was created from the unittest output pb2nc/gdas1.20120409.t12z.prepbufr.nc
  • PointStatConfig_ugrid_mpas_diag was modified:
  157c157
  < ugrid_coordinates_file = "${MET_TEST_INPUT}/ugrid_data/mpas/static.40962_reduced.nc"; 
 ---
  > ugrid_coordinates_file = "/home/dadriaan/projects/mpas/tutorial/data/fcst/mpas/ugrid/OK_12km_ugrid/init.nc";

ugrid_coordinates_file = /home/dadriaan/projects/mpas/tutorial/data/fcst/mpas/ugrid/OK_12km_ugrid/init.nc was changed to ugrid_coordinates_file = "${MET_TEST_INPUT}/ugrid_data/mpas/static.2025-05-17.9506.OK_reduced.nc";

@sonarqubecloud

Copy link
Copy Markdown

@DanielAdriaansen DanielAdriaansen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I examined log file output from the unit tests run by @hsoh-u on seneca.

The log file I examined was located at:

/d1/personal/hsoh/git/pull_request/MET_bugfix_3410_ugrid_lead_time_develop/log_point_stat_ugrid_v5.log

I saw this output:

DEBUG 1: Forecast File: /d1/projects/MET/MET_test_data/unit_test/ugrid_data/mpas/diag.2025-05-18_12.00.00.9506.OK.nc
DEBUG 1: Observation File: /d1/projects/MET/MET_test_data/unit_test/obs_data/point_obs/gdas1.20250518.t12z.prepbufr_modified.nc
DEBUG 4:
DEBUG 4: Grid information:
DEBUG 4:    Projection: UnstructuredGrid
DEBUG 4:    n_face: 9506
DEBUG 4:
DEBUG 4:
DEBUG 4: Data plane information:
DEBUG 4:    plane min: 275.4225769
DEBUG 4:    plane max: 300.0091858
DEBUG 4:    valid time: 20250518_120000
DEBUG 4:    lead time: 120000
DEBUG 4:    init time: 20250518_000000
DEBUG 4:    accum time: 000000
DEBUG 4:
DEBUG 5: MetUGridDataFile::data_plane_array(VarInfo &, DataPlaneArray &) -> Found range match for VarInfo "temperature (temperature_925hPa)"
DEBUG 2:
DEBUG 2: --------------------------------------------------------------------------------
DEBUG 2:
DEBUG 2: Reading data for temperature/P925.
DEBUG 2: Using the forecast grid as the verification grid
DEBUG 3: Grid Definition: Projection: UnstructuredGrid n_face: 9506
DEBUG 2: Processing masking regions.
DEBUG 3: Processing Lat/Lon point mask: ALLLATLON
DEBUG 2: For temperature/P925, found 1 forecast levels, 0 forecast climatology mean and 0 standard deviation level(s), and 0 observation climatology mean and 0 standard deviation level(s).
DEBUG 2:
DEBUG 2: --------------------------------------------------------------------------------
DEBUG 2:
DEBUG 3: update_missing_values(T) hdr_inst_typ(data_type=i): found 11157 FillValues out of 11370
DEBUG 3: Processing each "obs.field" name as a GRIB code abbreviation since the point observations are specified as GRIB codes.
DEBUG 2: Searching 120275 observations from 11370 messages.
DEBUG 3: update_missing_values(T) obs_hgt(data_type=f): found 17267 FillValues out of 32768
DEBUG 3: update_missing_values(T) obs_hgt(data_type=f): found 15923 FillValues out of 32768
DEBUG 3: update_missing_values(T) obs_hgt(data_type=f): found 8394 FillValues out of 32768
DEBUG 3: update_missing_values(T) obs_hgt(data_type=f): found 7476 FillValues out of 21971
DEBUG 2:
DEBUG 2: --------------------------------------------------------------------------------
DEBUG 2:
DEBUG 2: Processing temperature/P925 versus TMP/P1000-500, for observation type ADPSFC, over region ALLLATLON, for interpolation method NEAREST(1), using 3160 matched pairs.
DEBUG 3: Number of matched pairs   = 3160
DEBUG 3: Observations processed    = 120275
DEBUG 3: Rejected: station id      = 0
DEBUG 3: Rejected: obs var name    = 107223
DEBUG 3: Rejected: valid time      = 0
DEBUG 3: Rejected: bad obs value   = 0
DEBUG 3: Rejected: off the grid    = 0
DEBUG 3: Rejected: topography      = 0
DEBUG 3: Rejected: level mismatch  = 7486
DEBUG 3: Rejected: quality marker  = 0
DEBUG 3: Rejected: message type    = 2406
DEBUG 3: Rejected: masking region  = 0
DEBUG 3: Rejected: bad fcst value  = 0
DEBUG 3: Rejected: bad climo mean  = 0
DEBUG 3: Rejected: bad climo stdev = 0
DEBUG 3: Rejected: mpr filter      = 0
DEBUG 3: Rejected: duplicates      = 0
DEBUG 2: Computing Categorical Statistics.
DEBUG 2: Computing Scalar Partial Sums and Continuous Statistics.

That output tells me:

  1. It's reading the new 2025 file from OK with 9506 cells
  2. The modified gdas obs file to align the observation times with the fcst valid time is being used
  3. It is comparing temperature from pressure level 925 hPa (P925) with all temperature values from the obs between 1000 and 500 hPa (P1000-500 ) that have a message type of ADPSFC
  4. With those criteria, it finds 3160 matched pairs
  5. The FCST_LEAD column in the output file has the correct lead time, as does the output file name

Howard's changes appear to be working, the unit test for point_stat for MPAS/ugrid is updated to newer MPAS data, and the observation valid time was altered to match the forecast.

I approve.

@hsoh-u
hsoh-u merged commit a91e968 into develop Sep 16, 2026
64 of 68 checks passed
@github-project-automation github-project-automation Bot moved this from 🔎 In review to 🏁 Done in METplus-13.0 Development Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🏁 Done

Development

Successfully merging this pull request may close these issues.

Bugfix: Enable MPAS UGRID support to parse forecast lead time from diag files

3 participants